todo_list = []
def create_task(time):
    content = input("please input your work:")
    tag = input("please input your work tag(life/study/work/others):")
    finish = False

    while True:
        try:
            importance = int(input("please enter the task importance(an integer between 1-3:"))
            if 1 <= importance <= 3:
                break
            print("It should be between 1 and 3")
        except ValueError:
            print("Please enter a valid integer")

    while True:
        daily_input = bool(input("Is it a daily routine?(True/False):"))
        if daily_input in [True, False]:
            daily = daily_input 
            break
        print("Invalid input,please enter True or False")


    if daily == True:
        DDL = int(time)
    else:
        try:
           DDL = int(input("Please enter the task deadline(eg.20251023):"))
        except ValueError:
           print("Please enter the task deadline:")

    task_dict = {
        "content": content,
        "tag": tag,
        "finish": finish,
        "importance": importance,
        "daily": daily,
        "DDL": DDL
    }
    return task_dict

def check_daily(time):
    today = int(time)
    # 用于存储要添加的新日常任务
    new_daily_tasks = []
    for task in todo_list:
        if task["daily"] and task["DDL"] != today:
            new_task = task.copy()
            new_task["DDL"] = int(today)
            new_task["finish"] = False
            new_daily_tasks.append(new_task)
    todo_list.extend(new_daily_tasks)
    print("Daily routine tasks added successfully!")


